// To parse this JSON data, do
//
//     final searchListModel = searchListModelFromJson(jsonString);

import 'dart:convert';

SearchListModel searchListModelFromJson(String str) => SearchListModel.fromJson(json.decode(str));

String searchListModelToJson(SearchListModel data) => json.encode(data.toJson());

class SearchListModel {
  Meta meta;
  List<ListElement> list;

  SearchListModel({
    required this.meta,
    required this.list,
  });

  factory SearchListModel.fromJson(Map<String, dynamic> json) => SearchListModel(
    meta: Meta.fromJson(json["meta"]),
    list: List<ListElement>.from(json["list"].map((x) => ListElement.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "meta": meta.toJson(),
    "list": List<dynamic>.from(list.map((x) => x.toJson())),
  };
}

class ListElement {
  int id;
  String caption;
  Geo aGeo;
  Geo bGeo;
  int province;
  int city;
  String address;
  String logo;
  String? price;

  ListElement({
    required this.id,
    required this.caption,
    required this.aGeo,
    required this.bGeo,
    required this.province,
    required this.city,
    required this.address,
    required this.logo,
    required this.price,
  });

  factory ListElement.fromJson(Map<String, dynamic> json) => ListElement(
    id: json["id"],
    caption: json["caption"],
    aGeo: Geo.fromJson(json["aGeo"]),
    bGeo: Geo.fromJson(json["bGeo"]),
    province: json["province"],
    city: json["city"],
    address: json["address"],
    logo: json["logo"],
    price: json["price"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "caption": caption,
    "aGeo": aGeo.toJson(),
    "bGeo": bGeo.toJson(),
    "province": province,
    "city": city,
    "address": address,
    "logo": logo,
    "price": price,
  };
}

class Geo {
  double lon;
  double lat;

  Geo({
    required this.lon,
    required this.lat,
  });

  factory Geo.fromJson(Map<String, dynamic> json) => Geo(
    lon: json["lon"]?.toDouble(),
    lat: json["lat"]?.toDouble(),
  );

  Map<String, dynamic> toJson() => {
    "lon": lon,
    "lat": lat,
  };
}

class Meta {
  int currentPage;
  int maxPage;
  int itemCount;
  int pageSize;

  Meta({
    required this.currentPage,
    required this.maxPage,
    required this.itemCount,
    required this.pageSize,
  });

  factory Meta.fromJson(Map<String, dynamic> json) => Meta(
    currentPage: json["currentPage"],
    maxPage: json["maxPage"],
    itemCount: json["itemCount"],
    pageSize: json["pageSize"],
  );

  Map<String, dynamic> toJson() => {
    "currentPage": currentPage,
    "maxPage": maxPage,
    "itemCount": itemCount,
    "pageSize": pageSize,
  };
}
